package com.example.paopao.consumer.homepage.controller;

import com.example.paopao.common.web.JsonResult;
import com.example.paopao.consumer.homepage.pojo.vo.HiringVO;
import com.example.paopao.consumer.homepage.pojo.vo.IndustryVO;
import com.example.paopao.consumer.homepage.pojo.vo.SearchCountVO;
import com.example.paopao.consumer.homepage.service.IIndexService;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("paopao/index/")
@Api(tags = "01.首页列表展示")
public class IndexController {

    @Autowired
    private IIndexService service;

    @PostMapping("search-count")
    @ApiOperation("热门搜索")
    @ApiOperationSupport(order = 100)
    public JsonResult listSearchCount(){
        List<SearchCountVO> searchCount = service.listSearchCount();
        return JsonResult.ok(searchCount);
    }

    @PostMapping("industry")
    @ApiOperation("全部工种")
    @ApiOperationSupport(order = 200)
    public JsonResult listIndustry(){
        List<IndustryVO> listIndustry = service.listIndustry();
        return JsonResult.ok(listIndustry);
    }

    @PostMapping("hiring")
    @ApiOperation("最新招工")
    @ApiOperationSupport(order = 300)
    public JsonResult listHiring(){
        List<HiringVO> listHiring = service.listHiringVO();
        return JsonResult.ok(listHiring);
    }


}
